<extend name="Public/base" />

<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2>修改便民信息</h2>
    </div>
    <!-- 标签页导航 -->
    <div class="tab-wrap">
        <ul class="tab-nav nav">
            <volist name=":parse_config_attr($model['field_group'])" id="group">
                <li data-tab="tab{$key}" <eq name="key" value="1">class="current"</eq>><a href="javascript:void(0);">{$group}</a></li>
            </volist>
        </ul>
        <div class="tab-content">
            <!-- 表单 -->
            <form id="form" action="{:U('edit?id='.$info['id'])}" method="post" class="form-horizontal">
                    <!-- 添加便民信息表单 -->
                <div class="form-item cf">
                    <label class="item-label">{$field['title']}<span class="check-tips">标题</span></label>
                    <div class="controls">
                        <input type="text" class="text input-large" name="title" value="{$info.title}">
                    </div>
                </div>
                <div class="form-item cf">
                    <label class="item-label">{$field['title']}<span class="check-tips">图片</span></label>
                    <div class="controls">
                        <input type="file" id="upload_picture_thumb">
                        <input type="hidden" name="thumb" id="cover_id_thumb" value="{$info.thumb}"/>
                        <div class="upload-img-box">
                            <notempty name="info.thumb_c">
                                <div class="upload-pre-item"><img src="{$info.thumb_c}"/></div>
                            </notempty>
                        </div>
                    </div>
                    <script type="text/javascript">
                        //上传图片
                        /* 初始化上传插件 */
                        $("#upload_picture_thumb").uploadify({
                            "height"          : 30,
                            "swf"             : "__STATIC__/uploadify/uploadify.swf",
                            "fileObjName"     : "download",
                            "buttonText"      : "上传图片",
                            "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                            "width"           : 120,
                            'removeTimeout'	  : 1,
                            'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
                            "onUploadSuccess" : uploadPicturethumb,
                        'onFallback' : function() {
                            alert('未检测到兼容版本的Flash.');
                        }
                        });
                        function uploadPicturethumb(file, data){
                            var data = $.parseJSON(data);
                            var src = '';
                            if(data.status){
                                $("#cover_id_thumb").val(data.id);
                                src = data.url || '__ROOT__' + data.path;
                                $("#cover_id_thumb").parent().find('.upload-img-box').html(
                                        '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                );
                            } else {
                                updateAlert(data.info);
                                setTimeout(function(){
                                    $('#top-alert').find('button').click();
                                    $(that).removeClass('disabled').prop('disabled',false);
                                },1500);
                            }
                        }
                    </script>
                </div>

                <div class="form-item cf">
                    <label class="item-label">{$field['title']}<span class="check-tips">内容</span></label>
                    <div class="controls">
                        <textarea name="content">{$info.content}</textarea>
                        {:hook('adminArticleEdit', array('name'=>'content','value'=>$info.content))}
                    </div>
                </div>

            <div class="form-item cf">
                <button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>
                <a class="btn btn-return" href="{:U('Information/index')}">返 回</a>
            </div>
            </form>
        </div>
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        $('#submit').click(function(){
            $('#form').submit();
        });

        $(function(){
            $('.time').datetimepicker({
                format: 'yyyy-mm-dd hh:ii',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });
            showTab();

        });
    </script>
</block>
